/*
 * BuildingFilter.h
 *
 *  Created on: Nov 20, 2008
 *      Author: Ryan
 */

#ifndef BUILDINGFILTER_H_
#define BUILDINGFILTER_H_

#include "FilterVisitor.h"

class BuildingFilter: public FilterVisitor
{
public:
	BuildingFilter(): _isBuilding(false) {}
	virtual ~BuildingFilter() {}

	virtual void visitUnit( const OOInterface::Unit& u ){}

	virtual void visitAirAspect( const OOInterface::AirAspect& a ){}
	virtual void visitLandAspect( const OOInterface::LandAspect& a ){}
	virtual void visitWaterAspect( const OOInterface::WaterAspect& a ){}

	virtual void visitBuilderAspect( const OOInterface::BuilderAspect& a ) {}
	virtual void visitBuildingAspect( const OOInterface::BuildingAspect& a ) { _isBuilding = true; _building = &a; }
	virtual void visitTransportAspect( const OOInterface::TransportAspect& a ){}

	virtual void visitReclaimableAspect( const OOInterface::ReclaimableAspect& a ){}
	virtual void visitResourceExtractorAspect( const OOInterface::ResourceExtractorAspect& a ) {}

	virtual bool isFiltered() { return !isBuilding(); }
	virtual void reset() { _isBuilding = false; _building = 0; }

	bool isBuilding() { return _isBuilding; }
	const OOInterface::BuildingAspect* getBuildingAspect() { return _building; }

private:
	bool _isBuilding;
	const OOInterface::BuildingAspect* _building;
};

#endif /* BUILDINGFILTER_H_ */
